<?php
/*********************/
/*                   */
/*  前台文章评论控制     */
/*   BY voiet        */
/*   2009-11-16       */
/*                   */
/*********************/

class cct_comment extends ctl_comment
{

	function toartcomment( $articleid )
	{
		if ( $this->system->getconf( "comment.verifyCode.".$item ) == "on" && md5( $_POST[$item."verifyCode"] ) != $_COOKIE[strtoupper( $item )."_RANDOM_CODE"] )
		{
			
			$this->splash( "failed", "back", "验证码录入错误，请重新输入" );
		}
		if($_POST['node_id'])$item='art'.$_POST['node_id'];
		else $item='art';
		if($_POST['node_id']==152)$forurl = 'modeldetail';
		elseif($_POST['node_id']==153)$forurl = 'unarticle';
		else $forurl = 'article';
		$objComment = $this->system->loadmodel( "comment/comment" );
		
		$aData['title'] = $_POST['title'];
		$aData['comment'] = $_POST['comment'];
			$aData['goods_id'] = $articleid;
			$aData['object_type'] = $item;
			$aData['author_id'] = $this->member['member_id'];
			$aData['author'] = $this->member['member_id'] ? $this->member['uname'] : __( "匿名" );
			$oLv = $this->system->loadmodel( "member/level" );
			$aLevel = $oLv->getfieldbyid( $runtime['member_lv'], array( "name" ) );
			$aData['levelname'] = $aLevel['name'];
			$aData['contact'] = $_POST['contact'] == "" ? $this->member['email'] : $_POST['contact'];
			$aData['time'] = time( );
			$aData['lastreply'] = 0;
			$aData['ip'] = remote_addr( );
			$aData['display'] = "false" ;
			$objComment->toartcomment( $aData, $item, $message );
			$this->splash( "success", $this->system->mkurl( $forurl, "index", array(
				$articleid
			) ), $message );
		
	}
	
	
	

}

?>